﻿using ETask.Api.Models;

namespace ETask.Api.Services
{
    public interface IGenericService<TEntity, TDto, TCreateDto, TUpdateDto> where TEntity : BaseEntity, new()
        where TDto : class, new()
        where TCreateDto : class, new()
        where TUpdateDto : class, new()
    {
        /// <summary>
        /// 获取分页数据
        /// </summary>
        public Task<PagedResult<TDto>> GetPagedAsync(int pageNumber, int pageSize);

        /// <summary>
        /// 根据ID获取单个实体
        /// </summary>
        public Task<TDto?> GetByIdAsync(int id);

        /// <summary>
        /// 创建新实体
        /// </summary>
        public Task<TDto> CreateAsync(TCreateDto createDto);

        /// <summary>
        /// 更新实体
        /// </summary>
        public Task<bool> UpdateAsync(int id, TUpdateDto updateDto);

        /// <summary>
        /// 删除实体
        /// </summary>
        public Task<bool> DeleteAsync(int id);

    }
}
